package com.hllxd.hism.star.basic.service.service;

import com.alibaba.fastjson.JSON;
import com.hllxd.hism.star.basic.service.dao.mapper.mis.DetectionLogMapper;
import com.hllxd.hism.star.basic.service.model.DetectionLogEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 计算任务白名单管理
 * @author xiyong.lxy
 * @date 2020-10-12 16:51
 */
@Slf4j
@Service("detectionLogService")
public class DetectionLogServiceImpl implements DetectionLogService {

    @Autowired
    private DetectionLogMapper yarnWhiteMapper;


    @Override public DetectionLogEntity getDetectionLog(Long id) {
        return yarnWhiteMapper.getDetectionLog(id);
    }

    @Override
    public Long setDetectionLog(DetectionLogEntity entity) {
        log.info("set param: {}", JSON.toJSONString(entity));
        if(entity.id==null || entity.id==0) {
            log.info("will insert entity.");
            return yarnWhiteMapper.insertDetectionLog(entity);
        } else {
            log.info("will update entity.");
            return yarnWhiteMapper.updateDetectionLog(entity);
        }
    }

    @Override
    public List<DetectionLogEntity> listDetectionLog() {
        return yarnWhiteMapper.listDetectionLog();
    }

    @Override
    public Boolean deleteDetectionLog(String ids) {
        return yarnWhiteMapper.deleteDetectionLog(ids);
    }
}
